package com.honeybee.cloud.framework.consul.health;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.beans.Transient;
import java.util.Date;

/**
 * @Description consul健康检查接口
 * @Author cheng
 * @Create 2018-11-19
 * @Since 1.0.0
 */
public abstract class IHealthController {


    /**
     * 健康检查
     *
     * @return
     */
    @RequestMapping(name = "健康检查", value = "/health",method = RequestMethod.GET)
    @Transient
    public String checkHealth() {
        String info =   DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MS_FORMAT.getPattern())+","+getServiceName() + ",health.";
        return info;
    }

    /**
     * 获取服务名
     * @return
     */

   public abstract String getServiceName();
}
